#include "widget.h"
#include "ui_widget.h"
#include<QDebug>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    timer = new QTimer(this);
    connect(this->timer,&QTimer::timeout,this,[this]()
    {
        qDebug()<<"触发timeout信号！";
        int val = ui->lcdNumber->value();
        if(val <= 0)
        {
            timer->stop();
            return;
        }
        ui->lcdNumber->display(val-1);
    });
    timer->start(1000);

}
Widget::~Widget()
{
    delete ui;
}

